﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SQLite;
using BartonExtension;

namespace SqliteWrapper
{
    public class SqliteConnectionManager
    {
        public string ConnectionString { get; set; }

        public SQLiteConnection GetSqliteConnection()
        {
            SQLiteConnection conn = new SQLiteConnection(ConnectionString);
            return conn;
        }

        public static SqliteConnectionManager Create(string DBPath)
        {
            SqliteConnectionManager manager = new SqliteConnectionManager()
            {
                ConnectionString = ConfigurationExtensions.ValueOfConfig("ConnectionString").FormatWith(
                                   DBPath,
                                   ConfigurationExtensions.ValueOfConfig("DBVersion")),
            };

            return manager;
        }
    }
}
